package cn.kgc.mvc.controller;

import cn.kgc.mvc.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * @author: mosin
 * @version: v1.0  2022/7/8
 */
@Controller
@RequestMapping("user")
public class UserController {

    //登录
    @RequestMapping("login")
    public  String  login(String username, String password, HttpSession session){
        System.out.println("用户登录请求已接收");
        System.out.println(username+":"+password);
        System.out.println("用户登录成功");
        User user = new User();
        user.setPassword(password);
        user.setUsername(username);

        session.setAttribute("user", user);

        return "index";
    }


    //注册
    @RequestMapping("register")
    public  String  register(){
        System.out.println("用户注册请求已接收");
        return "login";
    }

    //删除
    @RequestMapping("delete")
    public  String  delete(){
        System.out.println("用户删除请求已接收");
        return "WEB-INF/index";
    }


}
